<template>
  <div>
    <van-pull-refresh
      v-model="isLoading"
      @refresh="onRefresh"
      :disabled="is_disabled"
    >
      <nuxt-child
        keep-alive
        :setDisabled="setDisabled"
        :refreshFun="refreshFun"
        :setLoading="setLoading"
      />
    </van-pull-refresh>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      isLoading: false,
      is_disabled: true,
      _function: null
    };
  },
  computed: {},
  watch: {},
  methods: {
    onRefresh() {
      this.isLoading = true;
      if (this._function) {
        this._function();
      } else {
        this.isLoading = false;
      }
    },
    setDisabled(data) {
      this.is_disabled = data;
    },
    refreshFun(fun) {
      this._function = fun;
    },
    setLoading(data) {
      this.isLoading = data;
    }
  },
  created() {},
  mounted() {}
};
</script>

<style scoped></style>
